import 'package:flutter/material.dart';
import 'package:smart_home/pages/main/home.dart';
import 'package:smart_home/pages/main/mind.dart';
import 'package:smart_home/pages/main/profile.dart';
import 'package:smart_home/pages/main/widgets/bottom.dart';
import 'package:smart_home/router/index.dart';
import 'package:smart_home/style.dart';

final List<Widget> listPage = [
  HomePage(),
  MindPage(),
  ProfilePage(),
];

class MainPage extends StatefulWidget {
  const MainPage({Key? key}) : super(key: key);

  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  int index = INITMAINBODY;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: listPage[index],
      bottomNavigationBar: BottomNavigationBar(
        selectedItemColor: themeColor,
        type: BottomNavigationBarType.fixed,
        items: bottomItemList,
        currentIndex: index,
        onTap: (value) {
          setState(() {
            index = value;
          });
        },
      ),
    );
  }
}
